The present disclosure generally relates to virtualization systems, and more particularly to assigning resources to devices in a virtual environment.
A virtual machine is a portion of software that, when executed on appropriate hardware, creates an environment allowing the virtualization of an actual physical computer system. Each virtual machine may function as a self-contained platform, running its own operating system (OS) and software applications (processes).
A host machine is typically enabled to simultaneously run one or more virtual machines, where each virtual machine may be used by a local or remote client. The host machine allocates a certain amount of the host's resources to each of the virtual machines. Each virtual machine may use the allocated resources to execute applications, including operating systems known as guest operating systems. The hypervisor virtualizes the underlying hardware of the host machine or emulates hardware devices, making the use of the virtual machine transparent to the guest operating system or the remote client that uses the virtual machine. Typically, a hypervisor manages allocation and virtualization of computer resources and performs context switching, as may be necessary, to cycle between various virtual machines.
A virtual device may be exposed to a guest as part of the virtual machine. The virtual device is controlled by reading from and writing to its registers, which are mapped to Input/Output (I/O) resources (e.g., I/O ports and I/O memory). The use of I/O resources is device and architecture dependent. For example, on the i386, most Industry Standard Architecture (ISA) devices map their registers to I/O resources; however, Peripheral Component Interconnect (PCI) devices tend to map their registers to I/O memory. To initialize the device, the guest may assign an address space to the device. The address space may be either memory or I/O resource space or both.